<div class="portlet-content">           

  <div class="table-responsive">

    <h4 class="heading"><?php echo $exemple->intitule(); ?></h4> 
    <form action='partie_save.php' method='post' id="partie-save">     
     <div class="row" align="center">
     <?php if(isset($_GET['ex'])){ ?>
     <div class="col-lg-2"><input type="submit" value="TERMINER L'EXERCICE" /></div>
     <?php } else { ?>
     <div class="col-lg-2"><input type="submit" value="TERMINER L'EXEMPLE" /></div>
     <?php } if(isset($_GET['ex'])){ ?>
     <div class="col-lg-2"><input type="text" name="minutes" id="minutes" /> minutes</div>
     <div class="col-lg-2"><input type="text" name="secondes" id="secondes" /> secondes</div>
     <?php } ?>
     </div>
     <input type="text" name="idRefTest" value="<?php echo $acces->idRefTest(); ?>" hidden/>
	 <input type='text' name='idExercice' value='<?php echo $exemple->id(); ?>' hidden/>
    <hr/>        
                                
    <ul id="myTab1" class="nav nav-tabs">
        <?php
            for($i=1;$i<=$exercicemanager->getNbQuestion($exemple->id());$i++){
                if($i==1){$type = "class='active'";}else{$type = "";}
                echo"
                <li ".$type."'>
                  <a href='#".$i."' data-toggle='tab'>".$i."</a>
                </li>";						
            }
        ?>
        
    </ul>

    <div id="myTab1Content" class="tab-content">

        <?php
        
        for($i=1;$i<=$exercicemanager->getNbQuestion($exemple->id());$i++){
            $TabQuest = $questionmanager->getByExercice($exemple->id());
            $TabRep = $reponsemanager->getByQuestion($TabQuest[$i-1]->id());
            if($i==1){$type = "class='tab-pane fade in active'";}else{$type = "class='tab-pane fade'";}					
                ?>
                <div <?php echo $type; ?> id='<?php echo $i; ?>'>
                <?php 
					// création du select
					$selectOpen = "<select name='mot".$TabQuest[$i-1]->id()."[]'>";
					$selectClose = "</select>";
					$selectCorps = "";
					$selectCorps = "<option value=' '> </option>";
					foreach($reponsemanager->getByQuestion($TabQuest[$i-1]->id()) as $rep){ 
						$selectCorps = $selectCorps."<option value='".$rep->id()."'>".$rep->contenu()."</option>";
					}
					$selectFinal = $selectOpen.$selectCorps.$selectClose; // assemblage select
					
					
					$new_mot = str_replace("[/mot]", $selectFinal, $TabQuest[$i-1]->contenu()); // on remplace les balises par le select

				echo	"<p>".$new_mot."</p>"; ?>							
                </div>
            
<?php	} ?>
        
        
    </div>
    
        </form>

  </div> <!-- /.table-responsive -->

</div> <!-- /.portlet-content -->